<head table_top=Jtbtgt >
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
	<link rel="stylesheet" href="../addons/jy_tour/resource/mobile/css/base/base.css">
	<link rel="stylesheet" href="../addons/jy_tour/resource/mobile/css/base/swiper.min.css">
	<link rel="stylesheet" href="../addons/jy_tour/resource/mobile/css/base/footer.css">
	<link rel="stylesheet" href="../addons/jy_tour/resource/mobile/css/base/header.css">
	<link rel="stylesheet" href="../addons/jy_tour/resource/mobile/css/base/mobilebone.css">
	<link rel="stylesheet" href="../addons/jy_tour/resource/mobile/css/spot/spot.css">
	<script type="text/javascript"  src="../addons/jy_tour/resource/mobile/js/base/swiper.min.js" charset="utf-8"></script>
	<script type="text/javascript"  src="../addons/jy_tour/resource/mobile/js/base/lib-flexible.js" charset="utf-8"></script>
	<script type="text/javascript"  src="../addons/jy_tour/resource/mobile/js/base/mobilebone.js" charset="utf-8"></script>
	<script type="text/javascript"  src="../addons/jy_tour/resource/mobile/js/base/delayLoading.min.js" charset="utf-8"></script>
	 <script type="text/javascript"  src="../addons/jy_tour/resource/mobile/js/base/jquery.min.js" charset="utf-8"></script>
	 <script type="text/javascript"  src="../addons/jy_tour/resource/mobile/js/base/jquery.layer.js" charset="utf-8"></script>
	 <script type="text/javascript"  src="../addons/jy_tour/resource/mobile/js/base/validate.js" charset="utf-8"></script>
	 <script type="text/javascript"  src="../addons/jy_tour/resource/mobile/js/base/layer2.0/layer.js" charset="utf-8"></script>
	 <script type="text/javascript"  src="../addons/jy_tour/resource/mobile/js/base/stmath.js" charset="utf-8"></script>
</head>

<body>
<div class="page" id="pageHome" data-title="预订产品">
    <!-- 公用顶部 -->

    <div class="page-content">
        <section>
            <div class="wrap-content">
                <form action="{$cmsurl}spot/create" id="orderfrm" method="post">
                    <div ng-if="!userinfo.mid" class="login-hint-txt">
                        温馨提示：<a class="login-link" href="{$cmsurl}member/login" data-ajax="false">登录</a>可享受预订送积分、积分抵现！
                    </div>
                    <!-- 温馨提示 -->

                    <div class="booking-info-block clearfix">
                        <h3 class="block-tit-bar"><strong>预订信息</strong></h3>
                        <div class="spot-name-block">
                            <div class="tit">{{pagedata.ticket.title}}</div>
                            <div class="info">产品编号：{{pagedata.ticket.series}}</div>
                            <div class="info">景点名称：{{pagedata.ticket.spot.title}}</div>
                            <div class="info" id="ticketInfoentry">门票说明<i class="more-icon"></i></div>
                        </div>
                        <div class="block-item">
                            <ul>
                                <li class="choose-date-bar">
                                    <strong class="item-hd">使用日期</strong>
                                    <span class="more-type" id="chooseBookingDate">
                                        
                                        <span ng-repeat="cur_suit in pagedata.data" class="item-date" data-date="{$cur_suit['date']}" data-total="{$cur_suit['number']}" data-price="{$cur_suit['price']}">
                                            <span class="date">{{cur_suit.day}}</span>
                                            <span class="pri">{{cur_suit.price}}</span>
                                        </span>
                                        
                                        <a href="#choose_date" class="item-date">
                                            <span class="date">更多日期<i class="more-icon"></i></span>
                                            {php}$min_price=Model_Spot::get_minprice($suit_info['spotid'], $suit_info['id']);{/php}
                                            <span class="pri">{Currency_Tool::symbol()}{$min_price['price']}起</span>
                                        </a>
                                    </span>
                                </li>
                                <li>
                                    <strong class="item-hd">门票数量</strong>
                                    <span class="amount-opt-wrap">
                                        <a href="javascript:;" class="sub-btn">–</a>
                                        <input type="text" name="dingnum" id="field_dingnum" readonly class="num-text" maxlength="4" value="1">
                                        <a href="javascript:;" class="add-btn">+</a>
                                    </span>
                                </li>
                            </ul>
                        </div>
                    </div>
                    <!-- 预订信息 -->

                    <div class="booking-info-block clearfix">
                        <h3 class="block-tit-bar"><strong>订单联系人</strong></h3>
                        <div class="block-item">
                            <ul>
                                <li>
                                    <strong class="item-hd">联系人：</strong>
                                    <input type="text" name="linkman" id="field_linkman" class="write-info" placeholder="请填写真实姓名" value="{$userinfo['truename']}" />
                                    <span class="nd">(必填)</span>
                                </li>
                                <li>
                                    <strong class="item-hd">手机号码：</strong>
                                    <input type="text" name="linktel" id="field_linktel" class="write-info" placeholder="请输入常用手机号码"  value="{$userinfo['mobile']}" />
                                    <span class="nd">(必填)</span>
                                </li>
                            </ul>
                        </div>
                        <div class="block-remarks">
                            <strong class="item-hd">订单备注：</strong>
                            <textarea class="item-txt" name="remark"></textarea>
                        </div>
                    </div>
                    <!-- 订单联系人 -->

                    <!-- 游客信息 -->


                    <!-- 优惠政策 -->

                    <!-- 优惠信息 -->
                    <input type="hidden" name="suitid" id="field_suitid"/>
                    <input type="hidden" name="productid" id="field_productid" value="{$info['id']}"/>
                    <input type="hidden" id="field_price" value="0"/>

                    <input type="hidden" id="field_dingjin" value="0"/>
                    <input type="hidden" id="field_paytype" value="1"/>

                    <div class="booking-info-block clearfix">
                        <div class="block-item">
                            <ul>
                                <li>
                                    <strong class="item-hd">支付方式</strong>
                                    <span class="more-type" id="txt_paytype"></span>
                                </li>
                            </ul>
                        </div>
                    </div>
                    <!-- 支付方式 -->
                    {if $GLOBALS['cfg_spot_order_agreement_open']==1}
                    <div class="agreement-block">
                        <i class="check-box{if $GLOBALS['cfg_spot_order_agreement_selected']!=='0'} on{/if}"></i>我已阅读并同意<a href="#bkDocumentContent">《预订须知》</a>
                    </div>
                    {/if}
                </form>
                <!-- 预订协议 -->
                {if $GLOBALS['cfg_spot_order_agreement_open']==1}
                <input type="hidden" id="agreement_order" name="agreement_order"  value="{$GLOBALS['cfg_spot_order_agreement_selected']}"/>
                {/if}
            </div>
        </section>

        <div class="bom-fixed-content">
            <div class="bom-fixed-block">
                    <span class="total">
                        <em class="jg no-style" id="bbar_paytotal"></em>
                    </span>
                <span class="order-show-list" id="order-show-list">明细<i class="arrow-up-ico"></i></span>
                <a class="now-booking-btn" href="javascript:;">立即预订</a>
            </div>
        </div>
        <!-- 立即预订 -->

        <div class="fee-box" id="fee-box" style="display: none;">
            <div class="fee-container">
                <div class="fee-row">
                    <p class="ze">
                        <strong class="no-style">应付总额</strong>
                        <em class="fr no-style" id="board_total"></em>
                    </p>
                    <p class="sm hide" id="board_dingjin"></p>
                </div>
                <ul class="mx-list">
                    <li>
                        <strong id="board_suitname" class="no-style"></strong>
                        <em id="board_org_total" class="no-style"></em>
                    </li>
                    <li>
                        <span class="zk">-(扣减)</span>
                    </li>
                    <li class="board_discount">
                        <strong class="no-style">积分抵现</strong>
                        <em id="board_jifentprice" class="no-style">0</em>
                    </li>
                    <li class="board_discount">
                        <strong class="no-style">优惠券</strong>
                        <em id="board_coupon" class="no-style">{Currency_Tool::symbol()}0</em>
                    </li>
                </ul>
            </div>
        </div>
        <!-- 费用明细 -->

    </div>
</div>
<!--预订-->

<div ng-if="pagedata.spot_order_agreement_open==1" class="page out" id="bkDocumentContent">
    <header>
        <div class="header_top">
            <a class="back-link-icon" href="#pageHome" data-rel="back"></a>
            <h1 class="page-title-bar">预订须知</h1>
        </div>
    </header>
    <!-- 公用顶部 -->
    <div class="page-content">
        <div class="bk-document-page">
            <div class="bk-content-wrap">
               {{ cfg_spot_order_agreement}}
            </div>
        </div>
    </div>
</div>
<!--预订协议-->


<div class="page out" id="choose_date">
    <div class="header_top bar-nav">
        <a class="back-link-icon" href="javascript:;" data-rel="back"></a>
        <h1 class="page-title-bar">选择日期</h1>
    </div>
    <!-- 公用顶部 -->
    <div class="page-content full-page">
        <div class="calendar-container">
        </div>
        <!-- 选择日期 -->
    </div>
</div>
<script>
    var init_suitid = "{$suitid}";
    var CURRENCY_SYMBOL = "{Currency_Tool::symbol()}";
    var productid = "{$info['id']}";
    //  var field_arr={json_encode($fieldlist)};
    $(document).ready(function () {
        //门票说明
        $('#ticketInfoentry').on('click',function(){
            var index = layer.open({
                type: 1,
                content: $('#ticketInfo').html(),
                anim: 'up',
                className: 'layer-show-content',
                success: function(){
                    $('body').on('click','#closeTicketLayer',function(){
                        layer.close(index);
                    })
                }
            });
        });

        //弹出套餐选择菜单




 

        //数量修改
        $('.sub-btn,.add-btn').click(function () {
            if(!$("#field_startdate").val())
            {
                $.layer({type: 1, icon: 2, time: 1000, text: '请选择门票使用日期'});
                return false;
            }
            var num = $(this).siblings(".num-text").val();
            var num = !num ? 0 : parseInt(num);
            if ($(this).is('.sub-btn')) {
                num = num > 0 ? --num : 0;
            }
            else {
                num++;
            }
            var total=$("#chooseBookingDate>.cur").attr('data-total');
            if(total>0&&total<num){
                $.layer({type: 1, icon: 2, time: 1000, text: '所选日期的余票不足您需购买的门票量'});
                //$("#chooseBookingDate>.cur").removeClass('cur');
                //$("#field_startdate").val('');
                return false;
            }
            $(this).siblings(".num-text").val(num);
            refresh_tourers(num);
            get_total_price();
        });

        //预订须知
        $(".agreement-block .check-box").on("click", function () {
            if (!$(this).hasClass("on")) {
                $(this).addClass("on");
                //$(".receipt-item").show();
                $("#agreement_order").val(1);
            }
            else {
                $(this).removeClass("on");
                //$(".receipt-item").hide();
                $("#agreement_order").val(0);
            }
        });

        //明细列表
        $("#order-show-list").click(function () {
            //$("#fee-box").removeClass("hide");
            $("#fee-box").toggle();
        });
        $("#fee-box").click(function () {
            $(this).hide()
        })

        //游客选择
        $(".linkman-list li .check-icon").click(function () {
            var tourer = $(this).parents('li:first').data('fields');
            if ($(this).hasClass('on')) {
                $(this).removeClass('on');
                switch_tourer(tourer, 1);
            }
            else {
                if (switch_tourer(tourer)) {
                    $(this).addClass('on');
                }
            }
        });

        //证件类型弹出框
        $("#cardtype_con").click(function () {
            $(this).hide();
        })
        $("#cardtype_con .list li").click(function () {

        });

        $("#roombalance_type_btn").click(function () {
            $("#roombalance_type_con").show();
        });
        $("#roombalance_type_con ul li").click(function () {
            var txt = $(this).text();
            var val = $(this).attr('val');
            $("#field_roombalance_paytype").val(val);
            $("#txt_roombalance_type").text(txt);
            get_total_price(0);

        });
        $("#roombalance_type_con").click(function () {
            $(this).hide();
        });


        //证件类型选择
        $(document).on('click', '.tourer_cardtype', function () {
            $("#cardtype_con").show();
            $("#cardtype_con .list li").unbind();
            var tourer_field = this;
            $("#cardtype_con .list li").click(function () {
                $(tourer_field).val($(this).text());
            });
        })

        //游客性别选择
        $(document).on('click', '.tourer_item_sex .check-label-item', function () {
            $(this).addClass('checked');
            $(this).siblings().removeClass('checked');
            var val = $(this).data('value');
            $(this).siblings('input:hidden').val(val);
        })

        //日期选择
        $("#chooseBookingDate>span").click(function () {
		
            var date_obj=$(this);
           // var url = SITEURL + 'spot/ajax_price_day';
            var url ='spot/ajax_price_day';
            var suitid = $("#field_suitid").val();
			alert(suitid);
            var date =date_obj.attr('data-date');
            if(!date){
                return false;
            }
            var old_dingnum=$("#field_dingnum").val();
            var total=date_obj.attr('data-total');
            if(total>0&&total<old_dingnum){
                $.layer({type: 1, icon: 2, time: 1000, text: '所选日期的余票不足您需购买的门票量'});
                return false;
            }
            $.ajax({
                type: 'GET',
                url: url,
                data: {suitid: suitid, productid: productid,date:date},
                dataType: 'json',
                success: function (data) {
                    if(data.number!=0)
                    {
                        if(data.number>0&&data.number<old_dingnum)
                        {
                            $("#field_price").val(0);
                            $("#field_startdate").val('');
                            return false;
                        }else{
                            date_obj.siblings().removeClass('cur');
                            date_obj.addClass('cur');
                            $("#field_price").val(data.price);
                            $("#field_startdate").val(date);
                        }
                        get_total_price();
                    }
                    //$("#choose_date").show();
                }
            });
        });

        //日历选择
        $("#chooseBookingDate a").click(function () {
            var date_obj=$(this);
            $(".calendar-container").html('');
            var url = SITEURL + 'spot/ajax_price_calendar';
            var suitid = $("#field_suitid").val();
            $.ajax({
                type: 'GET',
                url: url,
                data: {suitid: suitid, productid: productid},
                dataType: 'html',
                success: function (data) {
                    $(".calendar-container").html(data);
                    var date =date_obj.attr('data-date');
                    if(date){
                        $("tr.calendar-bd>td>div").removeClass('active');
                        $("tr.calendar-bd>td[date='"+date+"']>div").addClass('active');
                    }
                    $("#choose_date").show();
                }
            });
        });


        //第一次刷新游客信息
        refresh_tourers();

        //选中游客
        function switch_tourer(tourer, isdelete) {
            var isset = false;
            $("#tourer_con .block-item ul").each(function () {
                if (isset) {
                    return;
                }
                var tourername = $(this).find('.tourer_tourername').val();
                if (isdelete && tourername == tourer['linkman']) {
                    $(this).find('input').val('');
                    isset = true;
                }
                else if (!isdelete && !tourername) {
                    for (var i in tourer) {
                        $(this).find('.tourer_' + i).val(tourer[i]);

                        if (i == 'cardtype') {
                            $(this).find('.t_cardtype_txt').text(tourer[i]);
                            $(this).find('.field_t_cardtype').val(tourer[i]);
                        }
                        if (i == 'sex') {
                            if (tourer[i] == 0 || tourer[i] == '女') {
                                $(this).find('.sex_female').trigger('click');
                            }
                            else {
                                $(this).find('.sex_male').trigger('click');
                            }
                        }

                    }
                    isset = true;
                }

            });
            return isset;
        }


        //刷新游客
        function refresh_tourers() {
            if ($("#tourer_con").length <= 0) {
                return;
            }
            var num = parseInt($("#field_dingnum").val());
            var exist_num = $("#tourer_con .block-item ul").length;
            exist_num = !exist_num ? 0 : exist_num;
            var only_one=$("#tourer_con").attr('data-max');
            if(exist_num==1&&only_one==1){
                return;
            }
            if (exist_num > num) {
                var cur_index = num - 1;
                $("#tourer_con .block-item ul:gt(" + cur_index + ")").remove();
            }
            else
            {
                for (var i = exist_num; i < num; i++) {
                    var html = gen_tourer(i + 1);

                    $("#tourer_con .block-item").append(html);
                    $(".tourer_item_sex .check-label-item").css('cursor', 'pointer');
                }
            }
            $(".t_cardtype").click(function () {
                // $(this).unbind();
                $("#cardtype_con").show();
                var cur_field = this;
                $("#cardtype_con li").unbind();
                $("#cardtype_con li").click(function () {
                    var val = $(this).text();
                    $(cur_field).find('.t_cardtype_txt').text(val);
                    $(cur_field).find('.field_t_cardtype').val(val);
                });
            });
        }

        //生成游客
        function gen_tourer(index) {
            var fields_str=$("#tourer_con").attr('data-field');
            if(fields_str){
                var fields_arr=fields_str.split(",");
                var html = '';
                html += '<ul><li><strong class="item-bt no-style">游客' + index + '</strong></li>';

                if($.inArray("tourername",fields_arr)>=0)
                {
                    html += '<li><strong class="item-hd no-style">姓名</strong>';
                    html += '<input type="text" class="write-info tourer_linkman tourer_tourername" fieldname="tourername" name="t_tourername[' + index + ']" placeholder="与乘客证件一致">';
                    html += '<span class="nd">(必填)</span></li>';
                }
                if($.inArray("sex",fields_arr)>=0)
                {
                    html += '<li class="tourer_item_sex">';
                    html += '<strong class="item-hd no-style">性别</strong>';
                    html += '<div class="sex-bar">';
                    html += '<span class="check-label-item sex_male checked" data-value="男"><i class="icon"></i>男</span>';
                    html += '<span class="check-label-item sex_female" data-value="女"><i class="icon"></i>女</span>';
                    html += '<input type="hidden" fieldname="sex" name="t_sex[' + index + ']" value="男"/>';
                    html += '</div></li>';
                }
                if($.inArray("mobile",fields_arr)>=0)
                {
                    html += '<li><strong class="item-hd no-style">手机号</strong>';
                    html += '<input type="text" class="write-info tourer_mobile" fieldname="mobile" name="t_mobile[' + index + ']" placeholder="请输入手机号"></li>';
                }
                if($.inArray("cardnumber",fields_arr)>=0)
                {
                    html += '<li><strong class="item-hd no-style t_cardtype"><span class="t_cardtype_txt">身份证</span><input type="hidden" fieldname="cardtype" class="field_t_cardtype" name="t_cardtype[' + index + ']" value="身份证"/><i class="down-ico"></i></strong>';
                    html += '<input type="text" class="write-info tourer_idcard" fieldname="cardnumber" name="t_cardnumber[' + index + ']" placeholder="请输入证件号码">';
                    html += '<span class="nd">(必填)</span></li>';
                }

                html += '</ul>';
                return html;
            }


        }
    });

    function choose_day(ele) {
        $("#choose_date div.calendar-container").find('td div.item.opt').removeClass('active');
        var adultprice = $(ele).attr('adultprice');
        var date = $(ele).attr('date');
        var number = $(ele).attr('number');
        var old_dingnum=$("#field_dingnum").val();
        if(number>0&&old_dingnum>number){
            $.layer({type: 1, icon: 2, time: 1000, text: '余票不足您所购票数'});
            return false;
        }
        $(ele).find('div.item.opt').addClass('active');
        $("#chooseBookingDate a.item-date").siblings().removeClass('cur');
        var selected=0;
        $("#chooseBookingDate>span.item-date").each(function () {
            if(selected==0&&date==$(this).attr('data-date'))
            {
                $(this).addClass('cur').attr('data-total',number).attr('data-date',date);
                selected=1;
            }
        });
        if(selected==0)
        {
            $("#chooseBookingDate a.item-date").addClass('cur').attr('data-total',number).attr('data-date',date);
            $("#chooseBookingDate a.item-date span.date").html(date+'<i class="more-icon"></i>');
            $("#chooseBookingDate a.item-date span.pri").text(CURRENCY_SYMBOL + adultprice);
        }
        $("#field_price").val(adultprice);
        $("#field_startdate").val(date);
        window.history.back();
        get_total_price();
    }

</script>

<!--预订部分JS-->
<script>
    $(function () {
        $(".now-booking-btn").click(function () {
            var check_status = check_form();
            if (check_status) {
                $("#orderfrm").submit();
            }
        });


        function check_form() {
            var suitid = $("#field_suitid").val();
            var dingnum = $("#field_dingnum").val();
            var linkman = $("#field_linkman").val();
            var linktel = $("#field_linktel").val();
            var startdate = $("#field_startdate").val();
            if($("#agreement_order").length>0)
            {
                var agreement_order=$("#agreement_order").val();
                if (agreement_order!=1) {
                    $.layer({type: 1, icon: 2, time: 1000, text: '请先仔细阅读我们的预订条款内容'});
                    return false;
                }
            }

            if (!suitid) {
                $.layer({type: 1, icon: 2, time: 1000, text: '请至少选择一个套餐'});
                return false;
            }

            if (!startdate) {
                $.layer({type: 1, icon: 2, time: 1000, text: '请先选择使用日期'});
                return false;
            }

            //预订数量
            if (dingnum < 1) {
                $.layer({type: 1, icon: 2, time: 1000, text: '预订数量不能为0'});
                return false;
            }

            //联系人
            if (!linkman) {
                $.layer({type: 1, icon: 2, time: 1000, text: '联系人不能为空'});
                return false;
            }

            if (!linktel) {
                $.layer({type: 1, icon: 2, time: 1000, text: '联系人手机号码不能为空'});
                return false;
            }
            if (!Validate.mobile(linktel)) {
                $.layer({type: 1, icon: 2, time: 1000, text: '联系人手机号码格式错误'});
                return false;
            }


            //游客所有信息
            var is_tourer_checked = false;
            $("#tourer_con .block-item ul li input").each(function () {
                if (is_tourer_checked) {
                    return;
                }
                var desc = $(this).siblings('.item-hd').text();
                var fieldname = $(this).attr('fieldname');
                desc = fieldname == 'cardtype' ? '证件类型' : desc;
                var value = $(this).val();
                if (fieldname == 'mobile') {
                    if (!value) {
                        $.layer({type: 1, icon: 2, time: 1000, text: '游客手机号码不能为空'});
                        is_tourer_checked = true;
                    }
                    else if (!Validate.mobile(value)) {
                        $.layer({type: 1, icon: 2, time: 1000, text: '游客手机号码格式错误'});
                        is_tourer_checked = true;
                    }
                }
                else if (fieldname == 'cardnumber') {
                    var cardtype = $(this).parents('li:first').find('.field_t_cardtype').val();
                    if (cardtype == '身份证') {
                        if (!Validate.idcard(value)) {
                            $.layer({type: 1, icon: 2, time: 1000, text: '游客身份证格式错误'});
                            is_tourer_checked = true;
                        }
                    }
                    else {
                        if (!value) {
                            $.layer({type: 1, icon: 2, time: 1000, text: '游客' + desc + '不能为空1'});
                            is_tourer_checked = true;
                        }
                    }
                }
                else {
                    if (!value) {
                        $.layer({type: 1, icon: 2, time: 1000, text: '游客' + desc + '不能为空2'});
                        is_tourer_checked = true;
                    }
                }
            });
            if (is_tourer_checked) {
                return false;
            }

            return true;

        }
    })
</script>


<!--公共函数JS-->
<script>


    //更新总价
    function get_total_price(a) {
        if (!a) {
            on_orgprice_changed();
        }
        var adultprice = parseFloat($('#field_price').val());
        var dingnum = parseInt($('#field_dingnum').val());

        var total_num = dingnum;
        var total = STMath.mul(dingnum , adultprice);


        var org_totalprice = total;
        $("#board_org_total").html(CURRENCY_SYMBOL + org_totalprice);
        $("#org_total_price").val(org_totalprice);


        //积分抵现
        var jifentprice = 0;
        if (typeof(jifentprice_calculate) == 'function') {
            jifentprice = jifentprice_calculate();
        }
        $("#board_jifentprice").html(CURRENCY_SYMBOL + jifentprice);

        total = STMath.sub(total,jifentprice);

        //设置优惠券
        var coupon_price = $('#coupon_price').val();
        coupon_price = !coupon_price ? 0 : coupon_price;
        if (coupon_price) {
            total = STMath.sub(total,coupon_price) ;
        }
        $("#board_coupon").html(CURRENCY_SYMBOL + coupon_price);


        if (total < 0) {
            var negative_params = {
                totalprice: total,
                jifentprice: jifentprice,
                couponprice: coupon_price,
                org_totalprice: org_totalprice
            };
            on_negative_totalprice(negative_params);
            return;
        }

        var total_dingjin = 0;
        var paytype = $("#field_paytype").val();
        if (paytype == 2) {
            var dingjin = $("#field_dingjin").val();
            total_dingjin =  STMath.mul(dingjin , total_num);
            var underline_total = total - total_dingjin;
            $("#bbar_paytotal").html("订金支付：" + CURRENCY_SYMBOL + total_dingjin);
            $("#board_dingjin").html("在线支付(定金)" + CURRENCY_SYMBOL + total_dingjin + "+到店付款" + CURRENCY_SYMBOL + underline_total);
            $("#board_dingjin").show();
            $("#board_total").html(CURRENCY_SYMBOL + total);
        } else {
            var total_final = total;
            $("#bbar_paytotal").html("应付总额：" + CURRENCY_SYMBOL + total_final);
            $("#board_dingjin").hide();
            $("#board_total").html(CURRENCY_SYMBOL + total_final);
        }

    }

    //当总价小于0时
    function on_negative_totalprice(params) {
        layer.open({
            type:3,
            content: '优惠价格超过产品总价，请重新选择优惠策略',
            btn: ['{__("OK")}']
        });
        if (typeof(coupon_reset) == 'function') {
            coupon_reset();
        }
        if (typeof(jifentprice_reset) == 'function') {
            jifentprice_reset();
        }
        get_total_price(1);
    }
    //当原始价格发生改变时
    function on_orgprice_changed() {
        if (typeof(coupon_reset) == 'function') {
            coupon_reset();
        }
        if (typeof(jifentprice_reset) == 'function') {
            jifentprice_reset();
        }
    }

</script>

</body>
</html>
